<template>
  <div class="ouats">
    <div class="ouat">
      <div class="nav_spj">
        <span>平价</span>
        <span>租车</span>
        <span>At Par</span>
      </div>
      <div class="zhanhao">
        <div class="zhanh">
          <label for="zhahao">帐号</label
          ><input
            type="text"
            id="zhahao"
            placeholder="请输入帐号"
            v-model="textz"
          />
        </div>
        <div class="mimas">
          <label for="mima">密码</label>
          <div class="inputs">
            <input
              :type="flasc ? tex : pas"
              id="mima"
              placeholder="请输入密码"
              v-model="passwor"
            />
            <van-icon
              name="eye-o"
              :color="flasc ? bluck : ''"
              @click="dianqi"
            />
          </div>
        </div>
      </div>
      <div class="denglu">
        <div class="denlb" @click="ccd">登录</div>
        <div>
          <span @click="register_">注册</span>
          <span @click="pwdback_">忘记密码</span>
        </div>
      </div>
    </div>
    <div class="flass">
      <img src="../../assets/register/denglubj.png" alt="" />
      <div class="bottom">
        <p>登陆及表示您同意<span>《平价驻车用户隐私协议》</span></p>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Toast } from "vant";
import {login} from '../../request/login_register/login_register';
Vue.use(Toast);
export default {
  props: {},
  mounted(){
    
  },
  data() {
    return {
      bluck: "#0c67f9",
      flasc: false,
      pas: "password",
      tex: "text",
      textz: "xiufang",
      passwor: "111111",
      pohoot: /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/,
      mima: /^\w{6,12}$/,
    };
  },
  methods: {
    dianqi() {
      this.flasc = !this.flasc;
    },
    register_() {
      this.$router.push("/register");
    },
    pwdback_() {
      this.$router.push("/pwdback");
    },
    ccd() {
      this.$router.push("/home");
      this.$router.push("/banner");
      // if (this.textz != "") {
      //   if (this.pohoot.test(this.textz) == true) {
      //     if (this.passwor != "") {
      //       if (this.mima.test(this.passwor) == true) {
      //         this.$toast.success({
      //           message: "登录成功",
      //           duration: 2000,
      //           onClose: (res) => {
      //             return this.$router.push("/home");
      //           },
      //         });
      //       } else {
      //         this.$toast.fail("密码输入错误");
      //       }
      //     } else {
      //       this.$toast.fail("请输入密码");
      //     }
      //   } else {
      //     this.$toast.fail("账号输入错误");
      //   }
      // } else {
      //   this.$toast.fail("请输入帐号");
      // } textz: "",passwor: "",
      login({
     "userNameOrPhoneNum":this.textz,
     "password":this.passwor
    }).then((res)=>{
      // console.log(res)
      if(res.message == "操作成功"){
        this.$router.push('/banner')
      }else{
        alert('用户名或密码不正确')
      }
    })
    },
  },
  components: {},
};
</script>

<style scoped lang="less">
.ouats {
  height: 100%;
}
.ouat {
  font-size: 0.2rem;
  margin: 0 0.24rem;
  display: flex;
  flex-direction: column;
}
.nav_spj {
  height: 3.22rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.4684rem;
  color: #0c67f9;
  font-weight: bolder;
  & > span:last-child {
    font-size: 0.4275rem;
  }
}
.zhanhao {
  margin: 0.7rem 0;
  font-size: 0.28rem;
  height: 2.08rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  & > div {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .zhanh > input {
    height: 0.86rem;
    padding: 0 0.19rem;
    width: 5.5rem;
    font-size: 0.24rem;
    color: #999999;
    border-radius: 0.05rem;
    border: none;
    border: 2px solid #e7e7e7;
  }
  .inputs {
    border: 2px solid #e7e7e7;
    height: 0.86rem;
    padding: 0 0.19rem;
    width: 5.5rem;
    font-size: 0.24rem;
    color: #999999;
    border-radius: 0.05rem;
    display: flex;
    align-items: center;
    & > input {
      flex: 1;
      border: none;
      height: 0.8rem;
    }
    & > .van-icon-eye-o {
      font-size: 0.35rem;
    }
  }
  label {
    font-weight: 900;
  }
}
.denglu {
  margin: 0.72rem 0 1.19rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 1.45rem;
  .denlb {
    background-color: #42a2fe;
    border-radius: 0.08rem;
    height: 1rem;
    text-align: center;
    line-height: 1rem;
    flex-direction: column;
  }
  & > div {
    display: flex;
    color: white;
    font-size: 0.36rem;
    justify-content: space-between;
    width: 100%;
    span {
      font-size: 0.28rem;
      color: #3d88f7;
    }
  }
}
.flass {
  position: relative;
  bottom: 0;
  height: 2.9rem;
  & > img {
    width: 3.86rem;
    height: 2.04rem;
    z-index: 5;
    position: absolute;
    top: 0;
    right: 0;
  }
}
.bottom {
  background-color: #e9f1ff;
  height: 1.95rem;
  width: 100%;
  position: absolute;
  bottom: -.37rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  & > p {
    z-index: 7;
    margin-bottom: 0.5rem;
    color: #bcbcbc;
    font-size: 0.2rem;
    text-align: center;
    & > span {
      color: #0c67f9;
    }
  }
}
</style>
